package com.jshx.sz.gdjt.thread;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONArray;
import org.json.JSONObject;

import com.jshx.sz.gdjt.util.AccessDBImp;
import com.jshx.sz.gdjt.util.TDESEncodeUtils;
import com.jshx.sz.gdjt.constant.ApplicationGlobal;

import android.content.pm.PackageInfo;
import android.os.Handler;
import android.os.Message;
 

public class PersonThread  extends Thread{
	private Handler handler;
	private String userId;
	
	private ArrayList  returnList = new ArrayList ();
	
	public PersonThread()
	{
		
	}
	public PersonThread(Handler handler, String userId,ArrayList  data)
	{
		this.handler=handler;
		this.userId=userId;
		this.returnList=data;
	}
	public void run() 
	{
		try {
			AccessDBImp dao= new AccessDBImp();
			String re=dao.proDB("getPersonList", ",'userId':'" + userId + "','type':'getPersonList'");
			ArrayList res=dao.splitDataList(re);
			dao.dataCopyArrayListToArrayList(res, returnList);
			
			Message msg=new Message();
			msg.what=ApplicationGlobal.data_obtained;
			handler.sendMessage(msg) ;
		} catch (Exception e) {
			System.out.println(e);
			e.printStackTrace();
			Message msg=new Message();
			msg.what=ApplicationGlobal.data_missed;
			handler.sendMessage(msg) ;
		}  
	}
	
	
	 
}
